{% extends 'base.html' %}
{% block content %}
<div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>远程批量执行命令</legend>
</fieldset>
<form class="layui-form" method="post" action="/mssh">
  <div class="layui-form-item" pane="">
    <label class="layui-form-label">选择服务器</label>
    <div class="layui-input-block">
      <input type="checkbox" name="like1" lay-skin="primary" title="10.206.0.3"><span style="display:none" >xxxx</span>
      <input type="checkbox" name="like1" lay-skin="primary" title="10.206.0.5">
      <input type="checkbox" name="like1" lay-skin="primary" title="10.206.0.6">
      <input type="checkbox" name="like1" lay-skin="primary" title="10.206.0.7">
      <input type="checkbox" name="like1" lay-skin="primary" title="10.206.0.8">
    </div>
    </div>
{#    <div class="layui-form-item">#}
{#    <label class="layui-form-label">用户名</label>#}
{#    <div class="layui-input-inline">#}
{#      <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">#}
{#    </div>#}
{#    </div>#}
{#    <div class="layui-form-item">#}
{#      <label class="layui-form-label">密码</label>#}
{#    <div class="layui-input-inline">#}
{#      <input type="password" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input">#}
{#    </div>#}
{#    </div>#}
        <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">命令指令</label>
        <div class="layui-input-block">
        <textarea name="cmd" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
        </div>

      <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
    <div style="margin-left: 45px">
        <h4>命令结果:</h4>
        <textarea rows="15" cols="120">
            {% if result %}
                {{ result }}
            {% endif %}
        </textarea>
    </div>


</div>

{% endblock %}

{% block js %}
<script>
layui.use('element', function(){
  var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块

  //监听导航点击
  element.on('nav(demo)', function(elem){
    //console.log(elem)
    layer.msg(elem.text());
  });
});

// pictu
layui.use(['carousel', 'form'], function(){
  var carousel = layui.carousel
  ,form = layui.form;

  //常规轮播
  carousel.render({
    elem: '#test1'
  });

  //改变下时间间隔、动画类型、高度
  carousel.render({
    elem: '#test2'
    ,interval: 1800
    ,anim: 'fade'
    ,height: '120px'
  });

  //设定各种参数
  var ins3 = carousel.render({
    elem: '#test3'
  });
  //图片轮播
  carousel.render({
    elem: '#test10'
    ,width: '720px'
    ,height: '360px'
    ,interval: 3000
  });

  //事件
  carousel.on('change(test4)', function(res){
    console.log(res)
  });

  var $ = layui.$, active = {
    set: function(othis){
      var THIS = 'layui-bg-normal'
      ,key = othis.data('key')
      ,options = {};

      othis.css('background-color', '#5FB878').siblings().removeAttr('style');
      options[key] = othis.data('value');
      ins3.reload(options);
    }
  };

  //开关事件
  form.on('switch(autoplay)', function(){
    ins3.reload({
      autoplay: this.checked
    });
  });
  // 自动播放控制
  form.on('select(autoplay)', function (obj) {
    // debugger;
    var autoplayValue = parseInt(obj.value);
    ins3.reload({
      autoplay: isNaN(autoplayValue) ? obj.value : autoplayValue
    });
  })

  $('.demoSet').on('keyup', function(){
    var value = this.value
    ,options = {};
    if(!/^\d+$/.test(value)) return;

    options[this.name] = value;
    ins3.reload(options);
  });

  //其它示例
  $('.demoTest .layui-btn').on('click', function(){
    var othis = $(this), type = othis.data('type');
    active[type] ? active[type].call(this, othis) : '';
  });
});
</script>
{% endblock %}



